<template>
  <div>
    <!--  -->
    <FilterTable ref="table" :isSelectColumn="false" :columns="columns" :fetchapi="fetchApi" :params="fetchParams" :datakey="'records'" :onColumnsChange="columns => (this.columns = columns)">
    </FilterTable>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'center'
      }"
    >
      <el-button @click="closeDrawer">关 闭</el-button>
    </div>
  </div>
</template>
<script>
import { dictionary } from '@/utils/dictMixin';
import { getDetail } from '@/api/omFinance/InvoiceMailManage/SalesListQuery';

export default {
  name: 'SonModel',
  mixins: [dictionary],
  props: ['type', 'rowData'],
  data() {
    return {
      columns: this.createdTable(),
      fetchApi: getDetail,
      fetchParams: {
        dealerCode: this.rowData.dealerCode,
        invoiceNo: this.rowData.invoiceNo
      }
    };
  },
  methods: {
    closeDrawer() {
      this.$emit('close', false, 'refresh');
    },
    createdTable() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          fixed: 'left',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '货物（劳务）名称',
          dataIndex: 'goodsName',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '规格型号',
          dataIndex: 'specifications',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '单位',
          dataIndex: 'unit',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '数量',
          dataIndex: 'num',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '单价',
          dataIndex: 'unitPrice',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '金额',
          dataIndex: 'amount',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '税率',
          dataIndex: 'rate',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '税额',
          dataIndex: 'taxAmount',
          sorter: true,
          filter: true,
          filterType: 'input'
        }
      ];
    }
  }
};
</script>
